package com.example.web;

import com.example.api.bean.Book;
import com.example.web.service.GWBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@SpringBootApplication
@Controller
public class WebApplication {

    @Autowired
    GWBookService gwBookService;

    public static void main(String[] args) {
        SpringApplication.run(WebApplication.class, args);
    }

    @RequestMapping("getBook")
    @ResponseBody
    public Book getBook(int id){
        return gwBookService.getBookById(id);
    }

}

